package com.dianrui.agent.view.calendar;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.AttributeSet;

import com.dianrui.agent.R;

public class CalendarDayTextView extends android.support.v7.widget.AppCompatTextView {
    public boolean isToday;
    private boolean isSTime;
    private boolean isETime;
    private Context context;

    public void setEmptyColor(int emptyColor) {
        this.emptyColor = emptyColor;
    }

    public void setFillColor(int fillColor) {
        this.fillColor = fillColor;
    }

    private int emptyColor = Color.parseColor("#00A3FF");
    private int fillColor = Color.parseColor("#00ff00");

    private Paint mPaintSTime;
    private Paint mPaintETime;



    public CalendarDayTextView(Context context) {
        super(context);
        initview(context);
    }

    public CalendarDayTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initview(context);
    }

    private void initview(Context context) {
        this.context=context;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        //根据当前逻辑开始时间必须先绘制结束时间
        super.onDraw(canvas);
    }

    public void setToday(boolean today) {
        isToday = today;
        this.setTextColor(context.getResources().getColor(R.color.red1));
    }

    public void isETime(boolean etime) {
        isETime = etime;
        isSelected(true);
    }

    public void isSTime(boolean stime) {
        isSTime = stime;
        isSelected(true);
    }



    public void isSelected(boolean isSelcted){
        if(isSelcted){
            this.setTextColor(context.getResources().getColor(R.color.white));
        }else {
            this.setTextColor(context.getResources().getColor(R.color.white));
        }
    }
}
